package com.firefighting.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.firefighting.dao.MaintenanceplanContentMapper;
import com.firefighting.entity.MaintenanceplanContent;

@Service
public class MaintenanceplanContentService {
	@Autowired
	private MaintenanceplanContentMapper maintenanceplanContentMapper;
	/**
	 * @author Hanjd
	 * 
	 * 修改维保内容下发状态
	 * */
	public void updateMaintenanceplanContent(MaintenanceplanContent maintenanceplanContent) {
		// TODO Auto-generated method stub
        try{
        	maintenanceplanContentMapper.updateByPlanIdContentId(maintenanceplanContent);
        }catch(Exception e){
        	e.printStackTrace();
        	throw new RuntimeException("更新失败");
        }
		
	}
	/**
	 * @author Hanjd
	 * 
	 * 获取详情
	 * */
	public MaintenanceplanContent queryByPlanIdContentId(Integer planId,Integer contentId,Integer buildingId) {
		// TODO Auto-generated method stub
        return maintenanceplanContentMapper.selectByPlanIdContentId(planId, contentId, buildingId);
		
	}
	
	/** zhyan 根据计划id和内容id列表查询完成状态  */
	public List<String> selectFinishedStateByPlanIdAndContentIdList(int maintenancePlanId, List<Integer> list)
	{
		return maintenanceplanContentMapper.selectFinishedStateByPlanIdAndContentIdList(maintenancePlanId, list);
	}
	
	/** zhyan 根据计划id和内容id列表更新完成状态  */
	public int updateFinishedStateByPlanIdAndContentIdList(String finishedState, int maintenancePlanId, List<Integer> list)
	{
		return maintenanceplanContentMapper.updateFinishedStateByPlanIdAndContentIdList(finishedState, maintenancePlanId, list);
	}
}
